﻿@model TidyBlog.MVC.WWW.Models.ArticleDetail

@{
	Layout = "~/Views/Shared/_Layout.cshtml";
	var article = Model.CurrentArticle;
	var routeValues = new { id = article.ArticleId };
}

@section Css{
<link href="@Url.Content("~/Content/article-detail.css")" rel="Stylesheet" type="text/css" />
}

<div class="main">
	<div class="inner">
		<article class="article">
			<header>
				<h1 class="article-title">@article.Title</h1>
				<ul class="article-info clearfix">
					<li class="article-posttime"><address>@article.AuthorName</address> 发表于
					<time datetime="@article.PostTime.AddHours(ViewBag.Setup.TimeZone).ToString("yyyy-MM-ddThh:mm:sszzz")">@article.PostTime.AddHours(ViewBag.Setup.TimeZone).ToString("yyyy-M-d H:mm")</time></li>
					<li>分类：<a href="@Url.Action("Index", new { id = article.CategoryId })">@article.CategoryName</a></li>
					<li>浏览次数：@article.ViewCount</li>
					<li>评论次数：<span class="comment-count">@article.CommentCount</span></li>
				</ul>
			</header>
			<div class="article-content">@Html.Raw(article.Content)</div>
			<footer>
				<div class="sns-share">
					<a href="#" data-snsname="sinawb"><img src="@Url.Content("~/Content/Images/sns-share-sinawb.gif")" alt="新浪微博" /></a>
					<a href="#" data-snsname="googleplus"><img src="@Url.Content("~/Content/Images/sns-share-googleplus.gif")" alt="Google+" /></a>
					<a href="#" data-snsname="douban"><img src="@Url.Content("~/Content/Images/sns-share-douban.gif")" alt="豆瓣网" /></a>
					<a href="#" data-snsname="neteasewb"><img src="@Url.Content("~/Content/Images/sns-share-neteasewb.gif")" alt="网易微博" /></a>
					<a href="#" data-snsname="tencentwb"><img src="@Url.Content("~/Content/Images/sns-share-qqwb.gif")" alt="腾讯微博" /></a>
					<a href="#" data-snsname="qqspace"><img src="@Url.Content("~/Content/Images/sns-share-qzone.gif")" alt="QQ空间" /></a>
					<a href="#" data-snsname="sohuwb"><img src="@Url.Content("~/Content/Images/sns-share-sohuwb.gif")" alt="搜狐微博" /></a>
					<a href="#" data-snsname="renren"><img src="@Url.Content("~/Content/Images/sns-share-renren.gif")" alt="人人网" /></a>
				</div>
			</footer>
		</article>

@if (ViewBag.Setup.CommentLimit > 0)
{
		<section id="comment-list" class="comment-list">
			<h2 class="titlebar">评论（共<em class="comment-count">@article.CommentCount</em>条）</h2>
			<div></div>
		</section>

		<div id="comment-form" class="comment-form">
			<h2 class="titlebar">参与讨论</h2>
			<form action="@Url.Action("Post", "Comment", routeValues)" method="post" class="clearfix">
	@if (ViewBag.User == null)
	{
				<div class="col-l">
					<p class="form-field textbox-with-label"><textarea class="form-text" name="Content" id="Content" rows="5" cols="40" style="height: 125px;"></textarea><label for="Content">请填写评论内容 <span class="required">*</span></label></p>
		@if (ViewBag.Setup.CommentLimit == 1)
		{
					<p class="form-prompt">(您发表的评论需经过管理员审核才会显示，带 <span class="required">*</span> 的是必填项)</p>
		}
				</div>
				<div class="col-r">
					<p class="form-field textbox-with-label"><input type="text" name="AuthorName" id="AuthorName" class="form-text" maxlength="20" /><label for="AuthorName">您的称呼 <span class="required">*</span></label></p>
					<p class="form-field textbox-with-label"><input type="text" name="Email" id="Email" class="form-text" /><label for="Email">Email（选填，保密）</label></p>
					<p class="form-field textbox-with-label"><input type="text" name="HomePage" id="HomePage" class="form-text" /><label for="HomePage">个人博客或主页（选填）</label></p>
					<div class="captcha">
						<span class="form-field textbox-with-label">
							<input type="text" name="captcha" id="captcha" class="form-text" maxlength="4" /><label for="captcha">验证码  <span class="required">*</span></label>
						</span>
						<span class="captcha-img" data-src="@Url.Content("~/GetCaptcha.ashx")" data-bgcolor="255,255,255" data-formname="comment" class="captcha-img"></span>
					</div>
					<p class="form-button"><input type="submit" value="发 表" class="button" /></p>
				</div>
	}
	else
	{
				<p class="form-field textbox-with-label"><textarea class="form-text" name="Content" id="Content" rows="5" cols="40"></textarea><label for="Content">请填写评论内容 <span class="required">*</span></label></p>
				<p class="comment-user">以身份 <strong>@ViewBag.User.Nickname</strong> 发表评论</p>            
				<p class="form-button"><input type="submit" value="发 表" class="button" /></p>
	}
				<input type="hidden" name="ArticleId" value="@Model.CurrentArticle.ArticleId" />
				<input type="hidden" id="comment-minlength" value="@ViewBag.Setup.MinCommentSize" />
				<input type="hidden" id="comment-maxlength" value="@ViewBag.Setup.MaxCommentSize" />
			</form>
		</div>
}

		<div class="adjacent-articles">
@if (Model.PrevArticle != null)
{
			<p>上一篇：<a href="@Url.Action("Detail", new { id = Model.PrevArticle.ArticleId })">@Model.PrevArticle.Title</a></p>
}
@if (Model.NextArticle != null)
{
			<p>下一篇：<a href="@Url.Action("Detail", new { id = Model.NextArticle.ArticleId })">@Model.NextArticle.Title</a></p>
}
		</div>
	</div>
</div>

<aside class="sidebar">
@{
	Html.RenderPartial("Sidebar_ArticleList", Model.RecommendArticles);
	Html.RenderPartial("Sidebar_ArticleRank", Model.ArticleViewRank);
	Html.RenderPartial("Sidebar_Others");
}
</aside>

@section Script{
<script>require('/page/article/detail/1.x/');</script>
<script src="@Url.Action("View", "Article", routeValues)"></script>
}